/**
 * @author ypz
 * @date 2021/9/14 15:08
 */
public class CompareObject {
    public static void main(String[] args) {
        Integer i = 129;
        Integer j = 129;
        int p = 129;
        int q = 129;
        Integer k = 50;
        Integer m = 50;
        String  a = "abc"; //常量池
        String b = "abc"; //常量池
        String c = new String("abc");//heap
        String d = new String("abc");//heap

        System.out.println(i==j); //false
        System.out.println(i.equals(j));//true
        System.out.println(p ==q);//true
        System.out.println(k==m);//true
        System.out.println(a==b);//true
        System.out.println(c==d);//false
        System.out.println(a==c);//false
    }
}
